<template>
  <view class="pages">
    <u-sticky offset-top="0" zIndex="10000">
      <up-navbar
        title="体重管理"
        :autoBack="true"
        :placeholder="true"
        bgColor="#F5EFFD"
        :titleStyle="titleStyle"
        :leftIconSize="26"
      >
      </up-navbar>
    </u-sticky>

    <view class="content">
      <view class="card_1">
        <view class="card_top">
          <view class="top_l">
            <view class="top_icon">
              <image src="@/static/yunchan/weight.png"></image>
              <text>体重记录</text>
            </view>
            <view class="l_text" v-if="!isTodayRecord">暂无记录</view>
            <view class="l_text" v-else>{{ updateTime }} 更新</view>
          </view>
          <view
            class="top_r"
            style="display: flex; align-items: center; justify-content: center"
            @click="addWeight"
          >
            <image src="@/static/yunchan/weight_add.png"></image>
          </view>
        </view>
        <view class="card_bottom">
          <view class="weight_value" v-if="!isTodayRecord">
            <text style="line-height: 20rpx">--.--</text>
            <text style="font-size: 20rpx; color: #777777; font-weight: 500; margin-left: 6rpx"
              >公斤</text
            >
          </view>
          <view class="weight_value" v-else>
            <text style="line-height: 20rpx">{{ todayRecordValue }}</text>
            <text style="font-size: 20rpx; color: #777777; font-weight: 500; margin-left: 6rpx"
              >公斤</text
            >
          </view>
          <view class="bottom_r" @click="navigateTo('/pregnancy/weight-management/weight-record')">
            <view class="r_top" v-if="!isHistoryRecord">暂无历史记录</view>
            <view class="r_top" v-else>查看记录</view>
            <view class="r_bottom" style="margin-top: 8rpx">快来每天记录吧～</view>
          </view>
        </view>
      </view>
      <view class="card_2">
        <view class="card_top">
          <view class="top_l">
            <view class="top_icon">
              <image src="@/static/yunchan/diet.png"></image>
              <text>饮食记录</text>
            </view>
            <view class="l_text" v-if="!isDietRecordTime">暂无记录</view>
            <view class="l_text" v-else>{{ dietRecordTime }} 更新</view>
          </view>
          <view class="top_r">
            <view
              class="detail"
              @click="navigateTo('/pregnancys/weight-management/diet-record/foods-and-sport')"
              >查看记录</view
            >
          </view>
        </view>
        <view class="card_bottom">
          <view
            class="card_list"
            v-for="(item, i) in dietList"
            :key="i"
            @click.stop="extraMeal(item, i)"
          >
            <view class="item_l">
              <view class="item_icon" :style="{ marginTop: i == 2 ? '14rpx' : '' }">
                <image
                  :src="item.isfinish ? item.activeIcon : item.incon"
                  style="width: 52rpx; height: 52rpx"
                  :style="{ marginTop: i == 1 ? '8rpx' : '' }"
                ></image>
              </view>
              <view class="item_text" style="margin-left: 6rpx">{{ item.name }}</view>
            </view>
            <view class="item_r">
              <image src="@/static/yunchan/weight_add.png" v-if="!item.isfinish"></image>
              <view class="add_icon" v-else>
                <up-icon name="checkmark-circle-fill" color="#8E70FF" size="24"></up-icon>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="card_1">
        <view class="card_top">
          <view class="top_l">
            <view class="top_icon">
              <image src="@/static/yunchan/motion.png"></image>
              <text>运动记录</text>
            </view>
            <view class="l_text" v-if="!isUpdataTime">暂无记录</view>
            <view class="l_text" v-else>{{ meanMotionValue.time }} 更新</view>
          </view>
          <view class="top_r">
            <image @click="addMotionRecord" src="@/static/yunchan/weight_add.png"></image>
          </view>
        </view>
        <view class="card_bottom">
          <view
            v-if="!isMeanMotion"
            class="bottom_l"
            style="margin-left: 10rpx; font-size: 26rpx; color: #333333"
          >
            暂无记录
          </view>
          <view
            v-else
            class="bottom_l"
            style="margin-left: 10rpx; font-size: 26rpx; color: #333333"
          >
            平均<text style="font-weight: 600; font-size: 30rpx; color: #333333; margin: 0 10rpx">{{
              meanMotionValue.data.average_duration
            }}</text
            >分钟
          </view>
          <view
            class="bottom_r"
            @click="navigateTo('/pregnancys/weight-management/diet-record/foods-and-sport')"
          >
            <view class="r_top" v-if="!isMeanHistoryMotion">暂无历史记录</view>
            <view class="r_top" v-else>查看记录</view>
            <view class="r_bottom" style="margin-top: 8rpx">快来每天记录吧～</view>
          </view>
        </view>
      </view>
      <view class="card_1">
        <view class="card_top">
          <view class="top_l">
            <view class="top_icon">
              <image src="@/static/yunchan/sleep.png"></image>
              <text>睡眠记录</text>
            </view>
            <view class="l_text" v-if="!isSleepRecordTime">暂无记录</view>
            <view class="l_text" v-else>{{ sleepAverage.time || '' }} 更新</view>
          </view>
          <view class="top_r">
            <image src="@/static/yunchan/weight_add.png" @click="addSleep"></image>
          </view>
        </view>
        <view class="card_bottom">
          <view
            v-if="!isSleepRecord"
            class="bottom_l"
            style="margin-left: 10rpx; font-size: 26rpx; color: #333333"
          >
            暂无记录
          </view>
          <view
            v-else
            class="bottom_l"
            style="margin-left: 10rpx; font-size: 26rpx; color: #333333"
          >
            平均<text style="font-weight: 600; font-size: 30rpx; color: #333333; margin: 0 10rpx">{{
              sleepAverage.data.average_duration
            }}</text
            >小时
          </view>
          <view
            class="bottom_r"
            @click="navigateTo('/pregnancys/weight-management/sleep-record/index')"
          >
            <view class="r_top" v-if="!isSleepHistoryRecord">暂无历史记录</view>
            <view class="r_top" v-else>查看记录</view>
            <view class="r_bottom" style="margin-top: 8rpx">快来每天记录吧～</view>
          </view>
        </view>
      </view>
    </view>
    <!-- 体重管理弹窗 -->
    <u-popup
      :show="showWeight"
      :round="10"
      mode="bottom"
      @close="showWeight = false"
      @open="openWeight"
    >
      <view class="weight_pop_box">
        <view class="time">
          <text class="time_info">{{ todayTime }}</text>
          <text class="time_info" style="margin: 0 8rpx">{{
            weightTimeValue || formatDate(Date.now(), 'HH:mm')
          }}</text>
          <up-icon
            :name="flag ? 'arrow-up-fill' : 'arrow-down-fill'"
            color="#333333"
            size="14"
            @click="handletime"
          ></up-icon>
        </view>
        <view class="weight_pop_close" @click="weightPopClose">
          <up-icon name="close" color="#333333" size="20"></up-icon>
        </view>
        <numberKeyboard @saveInput="saveWeight"></numberKeyboard>
      </view>
    </u-popup>

    <!-- 时间选择弹窗 -->
    <u-popup :show="showTimePicker" :round="10" mode="bottom" @close="closetimepicker">
      <view>
        <view class="time">
          <text class="time_info">{{ todayTime }}</text>
          <text class="time_info" style="margin: 0 8rpx">{{
            weightTimeValue || formatDate(Date.now(), 'HH:mm')
          }}</text>
        </view>
        <view style="margin-top: 50rpx">
          <h-picker-dateTime
            :showValue="false"
            @changeTime="weightTimeChange"
            @confirm="weightTimeVerify"
            :value="formatDate(Date.now(), 'YYYY-MM-DD HH:mm')"
          ></h-picker-dateTime>
        </view>
      </view>
    </u-popup>
  </view>
  <!-- 加餐弹框 -->
  <u-popup :show="showExtraMeal" :round="10" mode="bottom" @close="showExtraMeal = false">
    <view class="ExtraMeal_box">
      <view
        class="ExtraMeal_list"
        v-for="(item, index) in extraMealList"
        :key="index"
        @click="addExtraMeal(index)"
        >{{ item }}</view
      >
      <view class="cancel" @click="cancelMeal">取消</view>
    </view>
  </u-popup>
  <!-- 睡眠管理管理弹窗 -->
  <u-popup :show="showSleep" :round="10" mode="bottom" @close="showSleepNot">
    <view class="sleep_pop_box">
      <view class="sleep_pop_title">
        <view>
          <up-tabs
            @click="sleepTypeChange"
            :list="sleepTypeList"
            lineWidth="0"
            :activeStyle="{
              fontWeight: 600,
              fontSize: '28rpx',
              color: '#333333',
            }"
            :inactiveStyle="{
              fontSize: '28rpx',
              color: '#666666',
            }"
            itemStyle="padding: 0 15px 0 0; height: 34px; text-align:left;"
          >
          </up-tabs>
        </view>
        <view class="pop_close" @click="sLeepPopClose">
          <up-icon name="close" color="#333333" size="20"></up-icon>
        </view>
      </view>
      <view class="fall_asleep">
        <view>
          <text>入睡时间</text>
          <text v-if="!isRestBind" style="margin-left: 20rpx; color: #666666">昨天</text>
          <text v-else style="margin-left: 20rpx; color: #666666">今天</text>
        </view>
        <view class="dateTime_box">
          <h-sleep-dateTime @timeChange="sleepStartTimeChange"></h-sleep-dateTime>
        </view>
      </view>
      <view class="fall_asleep">
        <view>
          <text>起床时间</text>
          <text style="margin-left: 20rpx; color: #666666">今天</text>
        </view>
        <view class="dateTime_box">
          <h-sleep-dateTime @timeChange="sleepEndTimeChange"></h-sleep-dateTime>
        </view>
      </view>
      <view class="sleep_time_save" @click="sleepTimeSave">保存</view>
    </view>
  </u-popup>
</template>

<script setup>
import { ref } from 'vue'
import numberKeyboard from '@/components/numberKeyboard/numberKeyboard.vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { navigateBack, navigateTo, formatDate, showToast } from '@/utils'
import {
  getTodayWeight,
  setRecordWeight,
  getRecordWeight,
  getAverage,
  getMotionRecordAverage,
  addRecordSleep,
} from '@/api/pregnancy/index'
import { ycDietDailyDiet } from '@/api/weight/index'
const titleStyle = ref('font-weight: 600;font-size: 36rpx;color: #333333;')
const todayTime = ref('今天')
//今日是否记录
const isTodayRecord = ref(false)
const todayRecordValue = ref('')
const updateTime = ref('')
//历史记录
const isHistoryRecord = ref(false)
const weightRecordPreams = ref({
  page: 1,
  limit: 10,
})
//饮食list
const dietList = ref([
  {
    name: '早餐',
    isfinish: false,
    incon: '/static/yunchan/breakfast.png',
    activeIcon: '/static/yunchan/breakfastA.png',
    addIcon: '/static/yunchan/weight_add.png',
    id: 1,
  },
  {
    name: '午餐',
    isfinish: false,
    incon: '/static/yunchan/lunch.png',
    activeIcon: '/static/yunchan/lunchA.png',
    addIcon: '/static/yunchan/weight_add.png',
    id: 2,
  },
  {
    name: '晚餐',
    isfinish: false,
    incon: '/static/yunchan/dinner.png',
    activeIcon: '/static/yunchan/dinnerA.png',
    addIcon: '/static/yunchan/weight_add.png',
    id: 3,
  },
  {
    name: '加餐',
    isfinish: false,
    incon: '/static/yunchan/add_meals.png',
    activeIcon: '/static/yunchan/add_mealsA.png',
    addIcon: '/static/yunchan/weight_add.png',
    id: 4,
  },
])
//加餐
const showExtraMeal = ref(false)
const extraMealList = ref(['早加餐', '午加餐', '晚加餐'])
//体重
const showWeight = ref(false)
const showTimePicker = ref(false)
//体重时间选择
const weightTimeValue = ref('')
//睡眠
const sleepTimeArr = ref([])
const weekupTime = ref([])
const isRestBind = ref(false)
//睡眠/小憩
const sleepTypeList = ref([{ name: '选择夜间睡眠时间' }, { name: '选择小憩时间' }])
//睡眠弹窗
const showSleep = ref(false)
//
const flag = ref(false)

onShow(() => {
  getTodayWeightData()
  getRecordWeightFn()
  getAverageFn()
  getMeanMotion()
  getDietDailyDiet()
})
//睡眠弹窗
function addSleep() {
  showSleep.value = true
}
//睡眠时间选择参数
const sleepPreams = ref({
  date: '',
  start_time: '',
  end_time: '',
  type: 1,
})
//睡眠选择
function sleepTypeChange(e) {
  if (e.index != 0) {
    isRestBind.value = true
    sleepPreams.value.type = 2
  } else {
    isRestBind.value = false
    sleepPreams.value.type = 1
  }
}
//睡眠开始时间
function sleepStartTimeChange(e) {
  let currentDate = new Date()
  currentDate.setDate(currentDate.getDate() - 1)
  if (!isRestBind.value) {
    sleepPreams.value.start_time = `${formatDate(currentDate, 'YYYY-MM-DD')} ${e}:00`
  } else {
    sleepPreams.value.start_time = `${formatDate(new Date(), 'YYYY-MM-DD')} ${e}:00`
  }
}
//睡眠结束时间
function sleepEndTimeChange(e) {
  sleepPreams.value.end_time = `${formatDate(new Date(), 'YYYY-MM-DD')} ${e}:00`
}
//睡眠保存
function sleepTimeSave() {
  if (!sleepPreams.value.start_time || !sleepPreams.value.end_time) {
    showToast('请选择睡眠时间')
  } else {
    sleepPreams.value.date = formatDate(new Date(), 'YYYY-MM-DD')
    addRecordSleepFn()
  }
}
//添加睡眠时间
async function addRecordSleepFn() {
  const res = await addRecordSleep(sleepPreams.value)
  if (res?.code == 200) {
    sleepPreams.value.start_time = ''
    sleepPreams.value.end_time = ''
    showToast(res.msg)
    showSleep.value = false
    getAverageFn()
  } else {
    showToast(res.msg)
  }
}
//
function sLeepPopClose() {
  showSleep.value = false
  isRestBind.value = false
}
function showSleepNot() {
  showSleep.value = false
  isRestBind.value = false
}
//关闭体重弹窗
function weightPopClose() {
  showWeight.value = false
}
const addWeight = () => {
  showWeight.value = true
}
const openWeight = () => {}
const handletime = () => {
  showWeight.value = false
  showTimePicker.value = true
  flag.value = !flag.value
}
const closetimepicker = () => {
  showTimePicker.value = false
  flag.value = !flag.value
  showWeight.value = true
}
//体重选择参数
const weightPreams = ref({
  weight: '',
  date: formatDate(Date.now(), 'YYYY-MM-DD'),
  set_time: formatDate(Date.now(), 'YYYY-MM-DD HH:mm'),
})
//体重时间选择
function weightTimeChange(e, n) {
  weightPreams.value.set_time = e
  todayTime.value = n
  weightTimeValue.value = e.split(' ')[1]
}
//体重时间确认
const isChangeTime = ref(false)
function weightTimeVerify() {
  if (!weightPreams.value.set_time) {
    showToast('请选择时间')
  } else {
    isChangeTime.value = true
    showTimePicker.value = false
    flag.value = !flag.value
    showWeight.value = true
    weightPreams.value.date = weightPreams.value.set_time.split(' ')[0]
  }
}
//保存体重
function saveWeight(e) {
  if (e == 0.0) {
    showToast('请输入体重')
  } else {
    weightPreams.value.weight = e
    if (isChangeTime.value == false) {
      weightPreams.value.set_time = formatDate(Date.now(), 'YYYY-MM-DD HH:mm')
    }
    setRecordWeightFn()
  }
}
//记录体重
async function setRecordWeightFn() {
  const res = await setRecordWeight(weightPreams.value)
  if (res?.code == 200) {
    getTodayWeightData()
    getRecordWeightFn()
    showToast(res.msg)
    showWeight.value = false
  } else {
    showToast(res.msg)
  }
}
//获取体重记录
async function getRecordWeightFn() {
  const res = await getRecordWeight(weightRecordPreams.value)
  if (res?.code == 200) {
    if (res.data.history_lst.total > 0) {
      isHistoryRecord.value = true
    } else {
      isHistoryRecord.value = false
    }
  }
}
//饮食
function extraMeal(item, index) {
  let today = formatDate(Date.now(), 'YYYY-MM-DD')
  if (index == 3) {
    showExtraMeal.value = true
  } else {
    navigateTo(`/pregnancys/weight-management/diet-record/index?mealIndex=${index}&time=${today}`)
  }
}
function cancelMeal() {
  showExtraMeal.value = false
}
//获取本日体重信息
async function getTodayWeightData() {
  const res = await getTodayWeight()
  if (res?.code == 200) {
    if (res?.data) {
      isTodayRecord.value = true
      todayRecordValue.value = res.data.num
      if (res?.data?.diff == 0) {
        updateTime.value = res.data.update_time
      } else {
        updateTime.value = `${res.data.diff}天前`
      }
    } else {
      isTodayRecord.value = false
    }
  }
}
//获取睡眠平均时长
const isSleepRecord = ref(false)
const isSleepRecordTime = ref(false)
const isSleepHistoryRecord = ref(false)
const sleepAverage = ref({})
async function getAverageFn() {
  const res = await getAverage()
  if (res?.code == 200) {
    if (res.data.is_record == 0) {
      isSleepHistoryRecord.value = false
    } else {
      isSleepHistoryRecord.value = true
    }
    if (res.data.time) {
      isSleepRecordTime.value = true
      sleepAverage.value = res.data
    } else {
      isSleepRecordTime.value = false
    }
    if (res.data.data.average_duration) {
      isSleepRecord.value = true
      sleepAverage.value = res.data
    } else {
      isSleepRecord.value = false
    }
  }
}
//获取运动平均时长
const isMeanMotion = ref(false)
const isUpdataTime = ref(false)
const isMeanHistoryMotion = ref(false)
const meanMotionValue = ref({})
async function getMeanMotion() {
  const res = await getMotionRecordAverage()
  if (res?.code == 200) {
    if (res.data.time) {
      isUpdataTime.value = true
      meanMotionValue.value = res.data
    } else {
      isUpdataTime.value = false
    }
    if (res.data.is_record == 0) {
      isMeanHistoryMotion.value = false
    } else {
      isMeanHistoryMotion.value = true
    }
    if (res.data.data.average_duration) {
      isMeanMotion.value = true
      meanMotionValue.value = res.data
    } else {
      isMeanMotion.value = false
    }
  }
}
//获取饮食记录
const isDietRecordTime = ref(false)
const dietRecordTime = ref('')
async function getDietDailyDiet() {
  const res = await ycDietDailyDiet({ date: formatDate(Date.now(), 'YYYY-MM-DD') })
  if (res?.code == 200) {
    if (res.data.lastDate) {
      isDietRecordTime.value = true
      dietRecordTime.value = res.data.lastDate
    } else {
      isDietRecordTime.value = false
    }
    let number = 0
    res.data.data.forEach((item, index) => {
      if (index < 3) {
        if (item.list.length > 0) {
          dietList.value[index].isfinish = true
        } else {
          dietList.value[index].isfinish = false
        }
      }
      if (index > 2) {
        number = number + item.list.length
        if (number > 0) {
          dietList.value[3].isfinish = true
        } else {
          dietList.value[3].isfinish = false
        }
      }
    })
  }
}
//加餐
function addExtraMeal(index) {
  showExtraMeal.value = false
  let today = formatDate(Date.now(), 'YYYY-MM-DD')
  navigateTo(`/pregnancys/weight-management/diet-record/index?mealIndex=${index + 3}&time=${today}`)
}
//添加运动记录
function addMotionRecord() {
  let today = formatDate(Date.now(), 'YYYY-MM-DD')
  navigateTo(`/pregnancys/weight-management/sport-record/index?time=${today}`)
}
</script>

<style lang="scss">
.pages {
  min-height: 100vh;
  background: linear-gradient(180deg, #f5effd 0%, #f6f6f6 100%);
  font-family: PingFang SC, PingFang SC;
}
.content {
  width: 702rpx;
  margin: 0 auto;
  padding-top: 20rpx;
  .card_1 {
    width: 100%;
    height: 266rpx;
    background: #ffffff;
    border-radius: 10rpx 10rpx 10rpx 10rpx;
    padding: 18rpx 20rpx 25rpx 23rpx;
    margin-bottom: 20rpx;
    .card_top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .top_l {
        display: flex;
        flex-direction: column;
        .top_icon {
          display: flex;
          align-items: center;
          image {
            width: 52rpx;
            height: 52rpx;
            margin-right: 5rpx;
          }
          text {
            font-weight: 600;
            font-size: 28rpx;
            color: #333333;
            margin-left: 10rpx;
          }
        }
        .l_text {
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 22rpx;
          color: #777777;
          margin-top: 10rpx;
          margin-left: 10rpx;
        }
      }
      .top_r {
        image {
          width: 54rpx;
          height: 54rpx;
        }
        .detail {
          width: 140rpx;
          height: 48rpx;
          background: #f3eaff;
          border-radius: 10rpx 10rpx 10rpx 10rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 22rpx;
          color: #8e71ff;
        }
      }
    }
    .card_bottom {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 14rpx;
      .weight_value {
        display: flex;
        align-items: center;
        font-weight: 600;
        font-size: 30rpx;
        color: #333333;
        margin-left: 10rpx;
      }
      .bottom_r {
        width: 267rpx;
        height: 125rpx;
        background: #f3eaff;
        border-radius: 10rpx 10rpx 10rpx 10rpx;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        .r_top {
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 22rpx;
          color: #957aff;
          margin-bottom: 4rpx;
        }
        .r_bottom {
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 20rpx;
          color: #8f8f8f;
        }
      }
    }
  }
  .card_2 {
    width: 702rpx;
    height: 537rpx;
    background: #ffffff;
    border-radius: 10rpx 10rpx 10rpx 10rpx;
    margin-bottom: 20rpx;
    padding: 18rpx 20rpx 25rpx 23rpx;
    margin-top: 20rpx;
    .card_top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .top_l {
        display: flex;
        flex-direction: column;
        .top_icon {
          display: flex;
          align-items: center;
          image {
            width: 52rpx;
            height: 52rpx;
            margin-right: 5rpx;
          }
          text {
            font-weight: 600;
            font-size: 28rpx;
            color: #333333;
            margin-left: 10rpx;
          }
        }
        .l_text {
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 22rpx;
          color: #777777;
          margin-top: 10rpx;
          margin-left: 10rpx;
        }
      }
      .top_r {
        .detail {
          width: 140rpx;
          height: 48rpx;
          background: #f3eaff;
          border-radius: 10rpx 10rpx 10rpx 10rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 22rpx;
          color: #8e71ff;
          text-align: center;
          line-height: 48rpx;
        }
      }
    }
    .card_bottom {
      .card_list {
        height: 108rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1rpx solid rgba(164, 164, 164, 0.4);
        .item_l {
          display: flex;
          align-items: center;
        }
        .item_r {
          image {
            width: 43rpx;
            height: 43rpx;
          }
        }
        &:last-child {
          border-bottom: none;
        }
      }
    }
  }
}
.weight_pop_box {
  position: relative;
  .time {
    display: flex;
    align-items: center;
  }
  .weight_pop_close {
    position: absolute;
    top: 26rpx;
    right: 20rpx;
    width: 42rpx;
    height: 42rpx;
    background: #f2f2f2;
    border-radius: 6rpx 6rpx 6rpx 6rpx;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
.time {
  margin-top: 30rpx;
  display: flex;
  justify-content: center;
  .time_info {
    font-weight: 600;
    font-size: 28rpx;
    color: #333333;
  }
}
//体重时间确认
.weight_time_verify {
  margin: 50rpx auto;
  width: 542rpx;
  height: 86rpx;
  background: #a28aff;
  border-radius: 106rpx 106rpx 106rpx 106rpx;
  font-size: 28rpx;
  color: #ffffff;
  text-align: center;
  line-height: 86rpx;
}
//睡眠弹窗
.sleep_pop_box {
  width: 700rpx;
  margin: 0 auto;
  .sleep_pop_title {
    margin-top: 20rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .pop_close {
      width: 42rpx;
      height: 42rpx;
      background: #f2f2f2;
      border-radius: 6rpx 6rpx 6rpx 6rpx;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
  .fall_asleep {
    padding: 0 30rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20rpx 0;
    .dateTime_box {
      width: 241rpx;
    }
    text {
      font-size: 28rpx;
      color: #333333;
    }
  }
  .sleep_time_save {
    margin: 30rpx auto;
    width: 702rpx;
    height: 88rpx;
    background: linear-gradient(90deg, #cb9fff 0%, #a28aff 100%);
    border-radius: 91rpx 91rpx 91rpx 91rpx;
    font-weight: 600;
    font-size: 32rpx;
    color: #ffffff;
    text-align: center;
    line-height: 88rpx;
  }
}
//加餐
.ExtraMeal_box {
  margin: 10rpx auto;
  .ExtraMeal_list {
    width: 686rpx;
    height: 100rpx;
    text-align: center;
    line-height: 100rpx;
    border-bottom: 2rpx solid #f6f6f6;
    font-size: 32rpx;
    color: #666666;
  }
  .cancel {
    width: 686rpx;
    height: 100rpx;
    text-align: center;
    line-height: 100rpx;
    font-size: 32rpx;
    color: #333333;
  }
}
</style>
